home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / modula2 / cal.com / TIME.DEF < prev    next >
Encoding:
Modula Definition  |  1989-06-03  |  1.7 KB  |  51 lines

  1. DEFINITION MODULE Time;
  2.  
  3.   CONST MinYear = 0001;       (* arbitrary limits; broad enough for  *)
  4.         MaxYear = 9999;       (*   for most practical cases purposes *)
  5.  
  6.   TYPE Month = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
  7.  
  8.        Date = RECORD
  9.                 da: [1..31];
  10.                 mo: Month;
  11.                 yr: [MinYear..MaxYear]
  12.               END;
  13.  
  14.        DayType = (Sun, Mon, Tue, Wed, Thu, Fri, Sat);
  15.  
  16.   PROCEDURE IsLeapYear(yr: CARDINAL): BOOLEAN;
  17.  
  18.   PROCEDURE NumDays(d: Date): LONGCARD;
  19.     (* NumDays returns an ordinal value for the date
  20.        with January 1, 0001 assigned the value 1.    *)
  21.  
  22.   PROCEDURE MakeDate(n: LONGCARD; VAR d: Date);
  23.     (* Takes an ordinal value compatible with that
  24.        returned by NumDays and forms the corresponding
  25.        date in d.                                      *)
  26.  
  27.   PROCEDURE DayOfWeek(d: Date): DayType;
  28.  
  29.   PROCEDURE GetSelDate(VAR d: Date; VAR abort: BOOLEAN);
  30.     (* General routine that allows the user to select
  31.        a date by positioning a "cursor" on the desired
  32.        date and pressing return; if <Esc> is pressed,
  33.        the date is left unchanged and abort becomes TRUE.
  34.  
  35.        d should be seeded with a valid date, which will
  36.        become determine the starting date upon calling
  37.        the procedure.                                     *)
  38.  
  39.   PROCEDURE IncDate(VAR d: Date; n: LONGCARD);
  40.     (* Increments the date by the value n. *)
  41.  
  42.   PROCEDURE DecDate(VAR d: Date; n: LONGCARD);
  43.     (* Decrements the date by the value n. *)
  44.  
  45.   PROCEDURE GetSysDate(VAR d: Date; VAR dayOfWeek: DayType);
  46.     (* Reads the system clock and assigns the date to d
  47.        and the day of the week to dayOfWeek.            *)
  48.  
  49.  
  50. END Time.
  51.